-
Notifications
You must be signed in to change notification settings - Fork 10
Add Elixir ESP NVS example #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add Elixir ESP NVS example #30
Conversation
|
Thank you! I'm not sure we want to show writing this much to nvs - see the warning here: https://doc.atomvm.org/latest/programmers-guide.html#non-volatile-storage Maybe change it to RTC https://doc.atomvm.org/latest/programmers-guide.html#rtc-memory - which obviously doesn't survive power outs, but doesn't wear down the flash.. |
|
Oh that makes sense — frequent writes to NVS are a bad pattern. I can convert the counter to RTC and revise the NVS usage to something that doesn’t write often, resulting in two examples. |
|
yeah, remember to try/catch the rtc_slow_get_binary() - as it will raise badarg when not set eg for you on first boot.. |
b50f818 to
12d5ef2
Compare
|
Thanks for the feedback. I updated the examples to avoid frequent NVS writes:
Example output: EspNvs: EspRtc: |
Excellent point! I should have caught this. |
12d5ef2 to
3ce9e58
Compare
|
We could also add standardized Potentially |
|
I'm wondering what the ideal name for the RTC slow memory example would be. Should we use something more specific, like |
I think |
I would not add .tool-versions, this should be up to the users choice. .gitignore is fine, but for simplicity I would prefer just one set of rules in the root directory, it can get harder to keep track of individual files through the directory tree. I am not sure if we need a formatter.exs, we just want to follow default formatting rules. But I am much more familiar with Erlang and |
|
Agree, I suggest not handling the projectwide .gitignore here though - also something good about seeing the avm file in git diff etc. so maybe no .gitignore is needed.. |
3ce9e58 to
c8a1ad9
Compare
|
this is great! I will have to admit I'm backtracking on the Should we have RebootState.ex in a separate file? then we also show good separation of everything.. and it's obvious to a beginner.. Sorry about not thinking the feedback through! |
c8a1ad9 to
8449b93
Compare
I tested it with my ESP32-S3 + v0.6.6 image.
Here is example log output: